package org.moda.table;

import java.util.Date;
import java.util.List;

public abstract sealed class Col<T> permits Col.ColBoolean, Col.ColDate, Col.ColNone, Col.ColNumber, Col.ColString, Col.ColStringArray {
    public final T value;

    protected Col(T value) {
        this.value = value;
    }

    public T get() {
        return value;
    }

    static final class ColNumber extends Col<Number> {
        private ColNumber(Number value) {
            super(value);
        }
    }

    static final class ColString extends Col<String> {
        private ColString(String value) {
            super(value);
        }
    }

    static final class ColBoolean extends Col<Boolean> {
        private ColBoolean(Boolean value) {
            super(value);
        }
    }

    static final class ColDate extends Col<Date> {
        private ColDate(Date value) {
            super(value);
        }
    }

    static final class ColStringArray extends Col<List<String>> {
        private ColStringArray(List<String> value) {
            super(value);
        }
    }

    static final class ColNone extends Col<Void> {
        private ColNone() {
            super(null);
        }
    }

    public static Col<Number> number(Number value) {
        return new ColNumber(value);
    }

    public static Col<String> string(String value) {
        return new ColString(value);
    }
    public static Col<Boolean> bool(boolean value) {
        return new ColBoolean(value);
    }
    public static Col<Void> none() {
        return new ColNone();
    }
}
